Skip to content

LINODE: BUGFIX: too picky about hyphens in names of SRV records - #4828

Merged
TomOnTime merged 13 commits into
mainfrom
tlim_v4812_linode
Sep 2, 2026
Merged

TomOnTime merged 13 commits into
mainfrom
tlim_v4812_linode

Conversation

@TomOnTime

@TomOnTime TomOnTime commented Aug 28, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #4812

  • Do the validation in auditrecords.go so that errors are caught earlier.
  • Extract service/protocol using parsig, not regex. Use less strict rules to validate labels. It's up to the API to make the final call. We can't emulate the API perfectly (that's a fools errand) therefore we shouldn't try.

@TomOnTime

Copy link
Copy Markdown
Collaborator Author

CC @dairiki: Please test.

There's a bugfix release going out in an hour or so. I'd love to include this, but I understand that's a tight schedule!

Thanks!

@dairiki dairiki left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for working on this!

I've tested this. It works for hyphenated service names.

As it stands, this does not work for SRV records on subdomains. See in-line comments for suggestions on a fixed and improved regexp.

Comment thread providers/linode/auditrecords.go Outdated
Comment thread providers/linode/auditrecords.go Outdated
Co-authored-by: Jeff Dairiki <dairiki@dairiki.org>
@TomOnTime

Copy link
Copy Markdown
Collaborator Author

PTAL

@dairiki

dairiki commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

@TomOnTime
There's a fix for the tests at dairiki/dnscontrol@7a4466f.

Otherwise, it looks good to me. Thank you!

@TomOnTime
TomOnTime requested a review from cafferata as a code owner August 30, 2026 12:56
@TomOnTime

Copy link
Copy Markdown
Collaborator Author

Never let a regex do what an algorithm can do better.

I've rewritten this to use strings.SplitN() instead of regex extraction. That allowed a much more simple regular expression.

It is less strict that the API, but that's ok. It's the API's job to validate. We can only do so much.

PTAL

@TomOnTime
TomOnTime requested a review from dairiki August 30, 2026 13:15
@TomOnTime

Copy link
Copy Markdown
Collaborator Author

When you test it, please make sure none of the integration tests are automatically skipped.

@dairiki dairiki left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SRV priority of zero is allowed.

The latest changes have re-broken SRV records on subdomains.

I'm working on running the integration tests. Some failures were reported the first time I ran them. I ran them again, with the output captured for better examination, and ... no errors. (My familiarity with go is zero, so it will take awhile to suss this out.)

There appear to be no integration tests that test the creation of SRV records on subdomains.

Comment thread documentation/provider/linode.md Outdated

Linode requires [`SRV`](../language-reference/domain-modifiers/SRV.md) records to have a non-zero priority.
Linode requires [`SRV`](../language-reference/domain-modifiers/SRV.md) records
to have a non-zero priority. Linode validates service name and protocol more

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A SRV priority of zero works with the Linode API. (I've tested it.) The priority, for both SRV and MX records, does seem to be limited to the range [0-255], however.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

Comment thread providers/linode/srvlabel.go Outdated
}

func validateSrvLabelHelper(label string) (string, string, error) {
parts := strings.SplitN(label, ".", 3)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This latest change has re-broken the ability to put SRV records in subdomains.

The only way to pass a subdomain to the Linode API is to include it in the "protocol" parameter. (I have no idea whether this is intentional or not, but there appears to be no other way to do it. As you have noted, it's a pretty crummy API design.)

I.e. if our zone is "example.org", and we want to create a SRV record at "_srv._proto.sub-domain.example.org", we need to pass service="srv" and protocol="proto.sub-domain" to Linode's API.

Here, the subdomain is in parts[2], which is currently being discarded.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See if f338e26 fixes that.

@TomOnTime TomOnTime self-assigned this Aug 31, 2026
@dairiki

dairiki commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

All seems to work now.

I can create SRV records on subdomains.

I've run the integration tests again, and they appear to have passed.

Thank you!

@TomOnTime

Copy link
Copy Markdown
Collaborator Author

Glad to help!

@TomOnTime
TomOnTime merged commit f96fde4 into main Sep 2, 2026
39 checks passed
@TomOnTime
TomOnTime deleted the tlim_v4812_linode branch September 2, 2026 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

LINODE: too picky about hyphens in names of SRV records

2 participants